package com.edu.zju.scs.panacea.entity.resource;

import com.alibaba.fastjson.JSON;
import java.util.List;

/**
 * @Author: Yue Liang
 * @Date: 2018-12-14 18:45
 */
public class Template {
    /**
     * 自增ID
     */
    private Long id;

    /**
     * 模板所属站点ID
     */
    private Long siteId;

    /**
     * 模板类型 0：图片 1：视频 2：h5
     */
    private Integer type;

    /**
     * 模板名称
     */
    private String name;

    /**
     * 允许文件的最大大小，单位为k
     */
    private Integer maxSize;

    /**
     * 图片高度，单位为像素
     */
    private Integer height;

    /**
     * 图片宽度，单位为像素
     */
    private Integer width;

    /**
     * 允许的文件格式
     * 图片 0: BMP  1：JPEG  2：GIF  3：PSD  4：PNG  5：TIFF  6：TGA  7：EPS
     * 视频 100：AVI  101：mov  102：rmvb  103：rm  104：FLV  105：mp4  106：3GP
     * 网页 200：h5
     */
    private List<Integer> format;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getMaxSize() {
        return maxSize;
    }

    public void setMaxSize(Integer maxSize) {
        this.maxSize = maxSize;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public Integer getWidth() {
        return width;
    }

    public void setWidth(Integer width) {
        this.width = width;
    }

    public List<Integer> getFormat() {
        return format;
    }

    public void setFormat(List<Integer> format) {
        this.format = format;
    }

    public Long getSiteId() {
        return siteId;
    }

    public void setSiteId(Long siteId) {
        this.siteId = siteId;
    }

    public void setFormat(String format) {
        @SuppressWarnings("unchecked")
        List<Integer> list = JSON.parseArray(format, Integer.class);//将json字符串转化成list
        setFormat(list);
    }


    @Override
    public String toString() {
        return "Template{" +
                "id=" + id +
                ", siteId=" + siteId +
                ", type=" + type +
                ", name='" + name + '\'' +
                ", maxSize=" + maxSize +
                ", height=" + height +
                ", width=" + width +
                ", format=" + format +
                '}';
    }
}
